package com.clayecloud.lib_common.room.services;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.clayecloud.lib_common.room.entity.ClientUser;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.Single;

@Dao
public interface ClientUserService {

    /**
     * 增加clientUser
     * @param clientUser
     * @return
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Single<Long> insertClientUser(ClientUser clientUser);

    /**
     * 删除clientUser
     * @param clientUser
     * @return
     */
    @Delete
    int deleteClientUser(ClientUser clientUser);


    /**
     * 更新clientUser
     * @param clientUser
     * @return
     */
    @Update
    Single<Integer> updateClientUser(ClientUser clientUser);


    /**
     * 根据id查询clientUser
     * @param userID
     * @return
     */
    @Query("select * from clientUser where user_id in (:userID)")
    Observable<ClientUser> getClientUserById(int userID);

    /**
     * 根据id查询clientUser
     * @param userID
     * @return
     */
    @Query("select * from clientUser where user_id in (:userID)")
    Single<ClientUser> getClientUserByIdWithSingle(int userID);

}
